Conversation
Signed-off-by: John McBride <john@zuplo.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for the _meta field in the ResourceMetadata interface, enabling resources to include flexible metadata as defined in the MCP specification.
- Adds
_metafield to theResourceMetadatainterface - Demonstrates usage with an example resource including custom metadata
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/resources/types.ts | Adds _meta field to ResourceMetadata interface to expose metadata capabilities |
| examples/servers/resources/src/index.ts | Demonstrates usage by adding _meta field with example data to a resource |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| mimeType?: string; | ||
| annotations?: Annotations; | ||
| size?: number; | ||
| _meta?: Resource["_meta"]; |
There was a problem hiding this comment.
This creates a circular type reference. The ResourceMetadata interface is referencing Resource["_meta"], which itself is defined in the MCP schema as z.optional(z.object({}).loose()). Instead of referencing Resource["_meta"], this should directly define the type as Record<string, unknown> or use a similar type definition to match the schema's loose object type. This avoids the circular dependency and correctly represents the flexible metadata structure.
| _meta?: Resource["_meta"]; | |
| _meta?: Record<string, unknown>; |
Exposes the
_metafield for resources.